package beans;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 *	Predstavlja klasu PutnaDuz 
 * */
@SuppressWarnings("serial")
public class TripPartBean implements Serializable{
	private Integer ID;

	private double cena;

	private Date polazak;

	private Date dolazak;

	public List<BeneffitBean> povlastica;

	public MestoBean mestoOd;

	public MestoBean mestoDo;

	public CarrierBean prevoznik;

	public TripPartBean() {
	}

	public TripPartBean(Integer iD, double cena, Date polazak, Date dolazak,
			List<BeneffitBean> povlastica, MestoBean mestoOd,
			MestoBean mestoDo, CarrierBean prevoznik) {
		super();
		ID = iD;
		this.cena = cena;
		this.polazak = polazak;
		this.dolazak = dolazak;
		this.povlastica = povlastica;
		this.mestoOd = mestoOd;
		this.mestoDo = mestoDo;
		this.prevoznik = prevoznik;
	}

	public Integer getID() {
		return ID;
	}

	public void setID(Integer iD) {
		ID = iD;
	}

	public double getCena() {
		return cena;
	}

	public void setCena(double cena) {
		this.cena = cena;
	}

	public Date getPolazak() {
		return polazak;
	}

	public void setPolazak(Date polazak) {
		this.polazak = polazak;
	}

	public Date getDolazak() {
		return dolazak;
	}

	public void setDolazak(Date dolazak) {
		this.dolazak = dolazak;
	}

	public List<BeneffitBean> getPovlastica() {
		return povlastica;
	}

	public void setPovlastica(List<BeneffitBean> povlastica) {
		this.povlastica = povlastica;
	}

	public MestoBean getMestoOd() {
		return mestoOd;
	}

	public void setMestoOd(MestoBean mestoOd) {
		this.mestoOd = mestoOd;
	}

	public MestoBean getMestoDo() {
		return mestoDo;
	}

	public void setMestoDo(MestoBean mestoDo) {
		this.mestoDo = mestoDo;
	}

	public CarrierBean getPrevoznik() {
		return prevoznik;
	}

	public void setPrevoznik(CarrierBean prevoznik) {
		this.prevoznik = prevoznik;
	}

	@Override
	public String toString() {
		SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");

		String retVal = "PutnaDuz - ID: " + ID + " , cena: " + cena;
		retVal += ", polazak: " + sdf.format(polazak);
		retVal += ", dolazak: " + sdf.format(dolazak);
		retVal += ", Ima povlastice: ";

		for(BeneffitBean ben : povlastica){
			retVal += ben + " "; 
		}			   

		retVal += "OD " + mestoOd + "Do " + mestoDo + prevoznik;
		return retVal;
	}

}